
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 template="template.xhtml"
                 xmlns:c="http://java.sun.com/jsp/jstl/core"
                 xmlns:f="http://java.sun.com/jsf/core">
    <!--

    xmlns:p="http://primefaces.prime.com.tr/ui"
    -->
    <ui:param name="title" value="Nyheter"/>

    <ui:define name="content">
        Database.<br/>

        <h:form>
            All Users:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        Firstname
                    </td>
                    <td>
                        Lastname
                    </td>
                    <td>
                        E-Mail
                    </td>
                    <td>
                        Username
                    </td>
                    <td>
                        Password
                    </td>
                    <td>
                        Avatar
                    </td>
                    <td>
                        Delete
                    </td>
                </tr>
                <c:forEach var="user" items="${modelBean.allUsers}">
                    <tr>
                        <td>
                            #{user.id}
                        </td>
                        <td>
                            #{user.firstName}
                        </td>
                        <td>
                            #{user.lastName}
                        </td>
                        <td>
                            #{user.email}
                        </td>
                        <td>
                            #{user.username}
                        </td>
                        <td>
                            #{user.password}
                        </td>
                        <td>
                            #{user.avatar}
                        </td>
                        <td>
                    <h:commandButton label="#{user.id}" value="Remove" actionListener="#{addControlBean.removeUser}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.firstname}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.lastname}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.email}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.username}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.password}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.avatar}"/>
                </td>
                <td>
                    ##
                </td>
                </tr>
            </table>
            <h:commandButton value="Add user" action="#{addControlBean.addUser}"/>
        </h:form>

        <h:form>
            Messages:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        Title
                    </td>
                    <td>
                        Time
                    </td>
                    <td>
                        Content
                    </td>
                    <td>
                        UserID
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="message" items="${modelBean.allMessages}">
                    <tr>
                        <td>
                            #{message.id}
                        </td>
                        <td>
                            #{message.title}
                        </td>
                        <td>
                            #{message.date}
                        </td>
                        <td>
                            #{message.message}
                        </td>
                        <td>
                            #{message.user.id}
                        </td>
                        <td>
                    <h:commandButton label="#{message.id}" value="Remove" actionListener="#{addControlBean.removeMessage}"/>
                    </td>
                    </tr>
                </c:forEach>

                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.title}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.time}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.content}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.userID}"/>
                </td>
                </tr>
            </table>
            <h:commandButton value="Add msg" action="#{addControlBean.addMessage}"/>
        </h:form>



        <h:form>
            Friends:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        USER_FK
                    </td>
                    <td>
                        FRIEND_FK
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="friend" items="${modelBean.allFriends}">
                    <tr>
                        <td>
                            #{friend.id}
                        </td>
                        <td>
                            #{friend.uuser}
                        </td>
                        <td>
                            #{friend.friend}
                        </td>
                        <td>
                    <h:commandButton label="#{friend.id}" value="Remove" actionListener="#{addControlBean.removeFriend}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.user}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.friend}"/>
                </td>
                </tr>
            </table>
            <h:commandButton value="Add Friend" action="#{addControlBean.addFriend}"/>
        </h:form>

        <h:form>
            Achievements:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        Title_sv
                    </td>
                    <td>
                        Title_en
                    </td>
                    <td>
                        desc_sv
                    </td>
                    <td>
                        desc_en
                    </td>
                    <td>
                        category
                    </td>
                    <td>
                        sub_category
                    </td>
                    <td>
                        images
                    </td>
                    <td>
                        points
                    </td>
                </tr>
                <c:forEach var="achi" items="${modelBean.allAchievements}">
                    <tr>
                        <td>
                            #{achi.id}
                        </td>
                        <td>
                            #{achi.title_sv}
                        </td>
                        <td>
                            #{achi.title_en}
                        </td>
                        <td>
                            #{achi.desc_sv}
                        </td>
                        <td>
                            #{achi.desc_en}
                        </td>
                        <td>
                            #{achi.category}
                        </td>
                        <td>
                            #{achi.sub_category}
                        </td>
                        <td>
                            #{achi.image}
                        </td>
                        <td>
                            #{achi.points}
                        </td>
                        <td>
                    <h:commandButton label="#{achi.id}" value="Remove" actionListener="#{addControlBean.removeAchievement}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.title_sv}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.title_en}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.desc_sv}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.desc_en}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.category}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.sub_category}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.image}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.points}"/>
                </td>

                </tr>
            </table>
            <h:commandButton value="Add Achi" action="#{addControlBean.addAchievement}"/>
        </h:form>


        <h:form>
            Achievements_comments:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        USER_FK
                    </td>
                    <td>
                        ACHI_FK
                    </td>
                    <td>
                        commenterID
                    </td>
                    <td>
                        date_created
                    </td>
                    <td>
                        message
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="acomments" items="${modelBean.allAchievements_comments}">
                    <tr>
                        <td>
                            #{acomments.id}
                        </td>
                        <td>
                            #{acomments.user}
                        </td>
                        <td>
                            #{acomments.achievement}
                        </td>
                        <td>
                            #{acomments.commenterID}
                        </td>
                        <td>
                            #{acomments.date_created}
                        </td>
                        <td>
                            #{acomments.message}
                        </td>
                        <td>
                    <h:commandButton label="#{acomments.id}" value="Remove" actionListener="#{addControlBean.removeAchievement_comment}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.comments_userID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.comments_achiID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.commenterID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.date_created_com}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.comments_message}"/>
                </td>
                </tr>
            </table>
            <h:commandButton value="Add AchiComment" action="#{addControlBean.addAchievement_comment}"/>
        </h:form>





        <h:form>
            Achievements_completed:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        USER_FK
                    </td>
                    <td>
                        ACHI_FK
                    </td>
                    <td>
                        description
                    </td>
                    <td>
                        date_completed
                    </td>
                    <td>
                        images
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="acompleted" items="${modelBean.allAchievements_completed}">
                    <tr>
                        <td>
                            #{acompleted.id}
                        </td>
                        <td>
                            #{acompleted.user}
                        </td>
                        <td>
                            #{acompleted.achievement}
                        </td>
                        <td>
                            #{acompleted.description}
                        </td>
                        <td>
                            #{acompleted.date_completed}
                        </td>
                        <td>
                            N/A
                        </td>
                        <td>
                    <h:commandButton label="#{acompleted.id}" value="Remove" actionListener="#{addControlBean.removeAchievement_completed}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.completed_userID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.completed_achiID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.description}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.date_completed}"/>
                </td>
                <td>
                N/A
                </td>
                </tr>
            </table>
            <h:commandButton value="Add AchiCompleted" action="#{addControlBean.addAchievement_completed}"/>
        </h:form>





         <h:form>
            Achievements_suggested:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        USER_FK
                    </td>
                    <td>
                        ACHI_FK
                    </td>
                    <td>
                        suggesterID
                    </td>
                    <td>
                        date_suggested
                    </td>
                    <td>
                        suggest_message
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="asuggested" items="${modelBean.allAchievements_suggested}">
                    <tr>
                        <td>
                            #{asuggested.id}
                        </td>
                        <td>
                            #{asuggested.user}
                        </td>
                        <td>
                            #{asuggested.achievement}
                        </td>
                        <td>
                            #{asuggested.suggesterID}
                        </td>
                        <td>
                            #{asuggested.date_suggested}
                        </td>
                        <td>
                            #{asuggested.message}
                        </td>
                        <td>
                    <h:commandButton label="#{asuggested.id}" value="Remove" actionListener="#{addControlBean.removeAchievement_suggested}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.suggested_userID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.suggested_achiID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.suggesterID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.date_suggested}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.suggest_message}"/>
                </td>
                </tr>
            </table>
            <h:commandButton value="Add AchiSuggested" action="#{addControlBean.addAchievement_suggested}"/>
        </h:form>


        <h:form>
            Achievements_target:
            <table border="1" cellpadding="10" cellspacing="2" style="background-color:lightgray">
                <tr>
                    <td>
                        ID
                    </td>
                    <td>
                        USER_FK
                    </td>
                    <td>
                        ACHI_FK
                    </td>
                    <td>
                        Remove
                    </td>
                </tr>
                <c:forEach var="target" items="${modelBean.allAchievements_target}">
                    <tr>
                        <td>
                            #{target.id}
                        </td>
                        <td>
                            #{target.user}
                        </td>
                        <td>
                            #{target.achievement}
                        </td>
                        <td>
                    <h:commandButton label="#{target.id}" value="Remove" actionListener="#{addControlBean.removeAchievement_target}"/>
                    </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td>
                        #
                    </td>
                    <td>
                <h:inputText value="#{addBackBean.target_userID}"/>
                </td>
                <td>
                <h:inputText value="#{addBackBean.target_achiID}"/>
                </td>
                </tr>
            </table>
            <h:commandButton value="Add AchiTarget" action="#{addControlBean.addAchievement_target}"/>
        </h:form>


    </ui:define>

</ui:composition>